<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: checkout_confirmation_details.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

$module_smarty = new Smarty();
$module_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');

require_once (DIR_FS_INC.'inc.check_stock.php');
require_once (DIR_FS_INC.'inc.get_products_stock.php');
require_once (DIR_FS_INC.'inc.remove_non_numeric.php');
require_once (DIR_FS_INC.'inc.format_price.php');
require_once (DIR_FS_INC.'inc.get_attributes_model.php');

$module_content = array();
$any_out_of_stock = '';
$mark_stock = '';

for($i = 0, $n = sizeof($order->products); $i < $n; $i ++) {
	$module_content[$i] = array('PRODUCTS_NAME' => $order->products[$i]['name'],
								'PRODUCTS_DESC' => $order->products[$i]['desc'],
								'PRODUCTS_ID' => $order->products[$i]['id'],
								'PRODUCTS_QTY' => $order->products[$i]['qty'],
								'PRODUCTS_MODEL' => $order->products[$i]['model'],
								'PRODUCTS_SHIPPING_TIME'=>$order->products[$i]['shipping_time'],
								'PRODUCTS_IMAGE' => $order->products[$i]['image'],
								'IMAGE_ALT' => $order->products[$i]['name'],
								'PRODUCTS_PRICE' => $price->format($order->products[$i]['price'], true),
								'PRODUCTS_PRICE_TOTAL' => $price->format($order->products[$i]['final_price'], true),
								'ATTRIBUTES' => '');
								
	if(!empty($order->products[$i]['attributes'])) {
		$count_attr_value = '';
		$count_attr = '';
		$ii = 0;
		$a_price = '';
		reset($order->products[$i]['attributes']);
		foreach($order->products[$i]['attributes'] AS $attributes) { $ii++;
			$module_content[$i]['ATTRIBUTES'][] = array('MODEL' => get_attributes_model(get_prid($order->products[$i]['id']), $attributes['value'],$attributes['option']),
														'NAME' => $attributes['option'],
														'VALUE_NAME' => $attributes['value']);
			$count_attr = $ii;
		}
		$module_content[$i]['PRODUCTS_ATTR_COUNT'] = $count_attr+1;
	}
}
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->assign('module_content', $module_content);

$module_smarty->caching = false;
$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/checkout_confirmation_details.html');

$smarty->assign('MODULE_checkout_confirmation_details', $module);